package a.f.d.a;

import a.c.bb;
import a.c.k;
import a.c.m;
import a.c.w;
import a.c.x;
import a.d.s;
import a.d.u;
import a.f.o;
import a.f.r;
import a.f.wc;
import a.f.zc;
import a.i.l;
import a.i.p;
import a.i.y;

import java.awt.*;
import java.util.*;

public class c
  extends r
{
  private boolean g;
  private double h;
  public static boolean i;
  
  public double b()
  {
    return this.h;
  }
  
  public void a(double paramDouble)
  {
    this.h = paramDouble;
  }
  
  public boolean c()
  {
    return this.g;
  }
  
  public void a(boolean paramBoolean)
  {
    this.g = paramBoolean;
  }
  
  public boolean canLayout(o paramo)
  {
    boolean bool = d.R;
    if ((bool) || (a() != null)) {
      if (bool) {}
    }
    return a().canLayout(paramo);
  }
  
  public void doLayout(o paramo)
  {
    boolean bool2 = d.R;
    boolean bool1 = d.Q;
    if (!bool2) {
      if (paramo.n()) {
        return;
      }
    }
    k localk1 = paramo.c(i.c);
    k localk2 = paramo.c(i.a);
    k localk3 = paramo.c(i.b);
    label409:
    label509:
    Object localObject10;
    label881:
    Object localObject9;
    label1098:
    label1122:
    label1907:
    label1909:
    label1911:
    double d1;
    label1484:
    label2011:
    label2143:
    double d2;
    if (((bool2) || (localk1 != null)) && ((bool2) || ((localk2 != null) && (localk3 != null))))
    {
      HashSet localHashSet = new HashSet();
      Object localObject1 = paramo.v();
      do
      {
        if (!((w)localObject1).e()) {
          break;
        }
        localObject2 = ((w)localObject1).d();
        localHashSet.add(localk2.get(localObject2));
        ((w)localObject1).f();
        if ((!bool2) && (bool1)) {
          return;
        }
      } while (!bool1);
      localObject1 = new bb();
      Object localObject2 = new HashMap();
      HashMap localHashMap = new HashMap();
      int j = 0;
      k localk4 = paramo.c(i.d);
      k localk5 = paramo.c(i.e);
      if (!bool2)
      {
        Object localObject3 = paramo.v();
        Object localObject5;
        Object localObject6;
        Object localObject7;
        Object localObject8;
        do
        {
          if (!((w)localObject3).e()) {
            break;
          }
          localObject4 = ((w)localObject3).d();
          localHashMap.put(localk2.get(localObject4), localObject4);
          if ((!bool2) && (bool1)) {
            return;
          }
          if (!bool2)
          {
            if (localk1.getBool(localObject4))
            {
              localObject5 = localk3.get(localObject4);
              if (bool2) {
                continue;
              }
              if (!localHashSet.contains(localObject5))
              {
                if (bool2) {
                  continue;
                }
                if (!((bb)localObject1).contains(localObject4))
                {
                  ((bb)localObject1).add(localObject4);
                  localObject6 = new c_(paramo, (a.c.e)localObject4, j++);
                  localObject7 = new a_((Comparable)localObject6, null);
                  ((a_)localObject7).d(0.0D);
                  ((a_)localObject7).c(0.0D);
                  if (!bool2) {
                    if (localk4 != null)
                    {
                      if (bool2) {
                        break label409;
                      }
                      localObject8 = u.a(localk4.get(localObject4));
                      if (localObject8 != null)
                      {
                        ((a_)localObject7).c(((u)localObject8).c);
                        ((a_)localObject7).d(((u)localObject8).e);
                      }
                    }
                  }
                  if (!bool2)
                  {
                    if (localk5 != null)
                    {
                      localObject8 = localk5.get(localObject4);
                      if (bool2) {
                        break label509;
                      }
                      if ((localObject8 instanceof s)) {
                        ((a_)localObject7).b(((s)localObject8).b());
                      }
                    }
                    ((a_)localObject7).b = ((a_)localObject7).f();
                    ((a_)localObject7).m = ((a_)localObject7).g();
                    ((a_)localObject7).d(((a_)localObject7).g() + this.h);
                    ((a_)localObject7).a(this.g);
                  }
                  ((Map)localObject2).put(localObject4, localObject7);
                }
              }
            }
            ((w)localObject3).f();
          }
        } while (!bool1);
        localObject3 = new y(paramo);
        Object localObject4 = new Comparator()
        {
          private final Map val$descriptorMap;
          
          public int compare(Object paramAnonymousObject1, Object paramAnonymousObject2)
          {
            Comparable localComparable1 = (Comparable)this.val$descriptorMap.get(paramAnonymousObject1);
            Comparable localComparable2 = (Comparable)this.val$descriptorMap.get(paramAnonymousObject2);
            return localComparable1.compareTo(localComparable2);
          }
        };
        ((y)localObject3).a((bb)localObject1);
        if (!bool2)
        {
          localObject5 = ((y)localObject3).l();
          do
          {
            do
            {
              if (!((m)localObject5).e()) {
                break;
              }
              wc.b(paramo, ((m)localObject5).a());
              ((m)localObject5).f();
              if (bool2) {
                break label2143;
              }
              if (bool1) {
                break label2139;
              }
            } while (!bool1);
          } while (bool2);
          if (!paramo.n())
          {
            localObject5 = new vc(new c_(paramo, null, ++j));
            ((vc)localObject5).a(false);
            ((vc)localObject5).c(0.0D);
            ((vc)localObject5).d(this.h);
            localObject6 = new p()
            {
              private final k val$parentIdKey;
              private final Map val$id2Node;
              private final bb val$roots;
              
              public Object get(Object paramAnonymousObject)
              {
                Object localObject1 = this.val$parentIdKey.get(paramAnonymousObject);
                Object localObject2 = this.val$id2Node.get(localObject1);
                if (!d.R) {
                  if (this.val$roots.contains(localObject2)) {
                    return this.val$parentIdKey.get(localObject2);
                  }
                }
                return localObject1;
              }
            };
            paramo.j(i.b);
            paramo.a(i.b, (k)localObject6);
            localObject7 = paramo.B();
            localObject8 = new HashSet();
            w localw1 = paramo.v();
            Object localObject11;
            Object localObject12;
            Object localObject13;
            do
            {
              do
              {
                if (!localw1.e()) {
                  break;
                }
                localObject10 = localw1.d();
                if ((!bool2) && (bool1)) {
                  break label1122;
                }
                localObject11 = localk3.get(localObject10);
                if (!localHashSet.contains(localObject11))
                {
                  ((x)localObject7).a(localObject10, localObject5);
                  if (bool2) {
                    continue;
                  }
                  if (bool1) {
                    continue;
                  }
                  if (!bool1) {
                    break label881;
                  }
                }
                while (bool2)
                {
                  localObject12 = (a.c.e)localHashMap.get(localObject11);
                  if (!bool2) {
                    if (((bb)localObject1).contains(localObject12))
                    {
                      localObject13 = (vc)((Map)localObject2).get(localObject12);
                      ((x)localObject7).a(localObject10, localObject13);
                      ((Set)localObject8).add(localObject12);
                      if (!bool2) {
                        if (!bool1) {
                          continue;
                        }
                      }
                    }
                    else
                    {
                      localObject11 = localk3.get(localObject12);
                    }
                  }
                  if (!bool1) {
                    break;
                  }
                }
                localw1.f();
              } while (!bool1);
            } while (bool2);
            if ((bool2) || ((((Set)localObject8).size() != ((bb)localObject1).size()) && (this.g)))
            {
              ((bb)localObject1).a((Comparator)localObject4);
              double d3 = 0.0D;
              localObject11 = null;
              localObject12 = ((bb)localObject1).l();
              do
              {
                if (!((w)localObject12).e()) {
                  break;
                }
                localObject13 = ((w)localObject12).d();
                vc localvc1 = (vc)((Map)localObject2).get(localObject13);
                if ((!bool2) && (bool1)) {
                  return;
                }
                if (!((Set)localObject8).contains(localObject13))
                {
                  double d6 = paramo.k((a.c.e)localObject13).c();
                  if (!bool2) {
                    if (localObject11 == null)
                    {
                      d3 += d6 + this.h;
                      if (bool2) {
                        continue;
                      }
                      if (!bool1) {
                        break label1098;
                      }
                    }
                  }
                  localObject11.d(localObject11.g() + d6 + this.h);
                  if (bool2) {
                    continue;
                  }
                  if (!bool1) {}
                }
                else
                {
                  localvc1.c(localvc1.f() + d3);
                  d3 = 0.0D;
                  localObject11 = localvc1;
                }
                ((w)localObject12).f();
              } while (!bool1);
            }
            if (!bool2)
            {
              localObject9 = paramo.c(a.f.d.e.A);
              if (!bool2)
              {
                if (localObject9 != null) {
                  paramo.j(localObject9);
                }
                paramo.a(a.f.d.e.A, (k)localObject7);
                a().doLayout(paramo);
                paramo.j(i.b);
                paramo.a(i.b, localk3);
                paramo.j(a.f.d.e.A);
                if (bool2) {}
              }
              else
              {
                if (localObject9 != null) {
                  paramo.a(a.f.d.e.A, (k)localObject9);
                }
                paramo.a((x)localObject7);
              }
              localObject10 = paramo.d();
              ((y)localObject3).g();
              double d4 = ((Rectangle)localObject10).y;
              double d5 = ((Rectangle)localObject10).y + ((Rectangle)localObject10).height;
              Object localObject14;
              if (!bool2)
              {
                if (localk4 != null)
                {
                  w localw2 = ((bb)localObject1).l();
                  do
                  {
                    if (!localw2.e()) {
                      break;
                    }
                    a.c.e locale1 = localw2.d();
                    localObject14 = u.a(localk4.get(locale1));
                    if (bool1) {
                      return;
                    }
                    if (localObject14 != null)
                    {
                      d4 = Math.min(((Rectangle)localObject10).y - ((u)localObject14).b, d4);
                      d5 = Math.max(((Rectangle)localObject10).y + ((Rectangle)localObject10).height + ((u)localObject14).d, d5);
                    }
                    localw2.f();
                  } while (!bool1);
                }
                d4 -= 10.0D;
              }
              if (!bool2) {
                d5 += 10.0D;
              }
              double d7 = d5 - d4;
              double d9;
              if (localk5 != null)
              {
                localObject14 = ((bb)localObject1).l();
                do
                {
                  if (!((w)localObject14).e()) {
                    break;
                  }
                  a.c.e locale2 = ((w)localObject14).d();
                  Object localObject15 = localk5.get(locale2);
                  if (bool1) {
                    break label1484;
                  }
                  if ((localObject15 instanceof s))
                  {
                    d9 = ((s)localObject15).c();
                    if (bool2) {
                      continue;
                    }
                    if (d7 < d9) {
                      d7 = d9;
                    }
                  }
                  ((w)localObject14).f();
                } while (!bool1);
              }
              if (!bool2)
              {
                int k = 0;
                double d8 = (0.0D / 0.0D);
                d9 = -1.797693134862316E+308D;
                if ((bool2) || (((Set)localObject8).isEmpty()))
                {
                  k = 1;
                  d8 = d9 = ((vc)localObject5).h() + ((vc)localObject5).i();
                }
                w localw3 = ((bb)localObject1).l();
                a.c.e locale3;
                vc localvc2;
                zc localzc2;
                do
                {
                  if (!localw3.e()) {
                    break;
                  }
                  locale3 = localw3.d();
                  localvc2 = (vc)((Map)localObject2).get(locale3);
                  localzc2 = paramo.d(locale3);
                  if (bool1) {
                    break label2011;
                  }
                  if (localvc2.j() >= 0)
                  {
                    double d10 = 0.0D;
                    double d11 = 0.0D;
                    Object localObject16;
                    if (!bool2)
                    {
                      if ((localvc2 instanceof a_))
                      {
                        localObject16 = (a_)localvc2;
                        d10 = localvc2.f() - ((a_)localObject16).b;
                        d11 = localvc2.g() - ((a_)localObject16).m;
                      }
                      localzc2.b(localvc2.i() - (d10 + d11), d7);
                      localzc2.a(localvc2.h() + d10, d4);
                      d8 = localzc2.a() + localzc2.c();
                      d9 = Math.max(d8, d9);
                    }
                    if (!bool2)
                    {
                      if (k == 0)
                      {
                        if (bool2) {
                          break label1907;
                        }
                        if (this.g)
                        {
                          localObject16 = ((bb)localObject1).l();
                          do
                          {
                            if (!((w)localObject16).e()) {
                              break;
                            }
                            if (bool1) {
                              break label2049;
                            }
                            if (((w)localObject16).j() == locale3) {
                              break;
                            }
                            ((w)localObject16).f();
                          } while (!bool1);
                          ((w)localObject16).g();
                          if (bool2) {
                            break label2122;
                          }
                          double d12 = localzc2.a();
                          do
                          {
                            if (!((w)localObject16).e()) {
                              break;
                            }
                            a.c.e locale4 = ((w)localObject16).d();
                            zc localzc3 = paramo.d(locale4);
                            localzc3.b(localzc3.c(), d7);
                            localzc3.a(d12 - localzc3.c() - this.h, d4);
                            d12 -= localzc3.c() + this.h;
                            ((w)localObject16).g();
                            if (bool2) {
                              break label1911;
                            }
                            if (bool1) {
                              break label1909;
                            }
                          } while (!bool1);
                        }
                      }
                      if (bool2) {
                        break label1911;
                      }
                    }
                    k = 1;
                    if (bool2) {
                      continue;
                    }
                    if (!bool1) {}
                  }
                  else
                  {
                    if (bool2) {
                      continue;
                    }
                    if (k != 0)
                    {
                      if (bool2) {
                        continue;
                      }
                      if (this.g)
                      {
                        localzc2.b(localzc2.c(), d7);
                        localzc2.a(d8 + this.h, d4);
                        d8 = localzc2.a() + localzc2.c();
                      }
                    }
                  }
                  localw3.f();
                } while (!bool1);
                if ((!bool2) && (!this.g))
                {
                  localw3 = ((bb)localObject1).l();
                  while (localw3.e())
                  {
                    locale3 = localw3.d();
                    label2049:
                    localvc2 = (vc)((Map)localObject2).get(locale3);
                    if (!bool2)
                    {
                      if (localvc2.j() < 0)
                      {
                        localzc2 = paramo.d(locale3);
                        localzc2.b(localzc2.c(), d7);
                        localzc2.a(d9 + this.h, d4);
                        label2122:
                        d9 = localzc2.a() + localzc2.c();
                      }
                      localw3.f();
                    }
                  }
                }
              }
            }
          }
          else
          {
            ((y)localObject3).g();
            label2139:
            if (this.g) {
              ((bb)localObject1).a((Comparator)localObject4);
            }
            d1 = 0.0D;
            localObject7 = ((bb)localObject1).l();
            do
            {
              if (!((w)localObject7).e()) {
                break;
              }
              localObject8 = ((w)localObject7).d();
              d1 = Math.max(d1, paramo.k((a.c.e)localObject8).d());
              ((w)localObject7).f();
              if ((!bool2) && (bool1)) {
                return;
              }
            } while (!bool1);
            d2 = 0.0D;
            if (!bool2) {
              localObject9 = ((bb)localObject1).l();
            }
          }
        }
      }
    }
    else
    {
      while (((w)localObject9).e())
      {
        localObject10 = ((w)localObject9).d();
        zc localzc1 = paramo.k((a.c.e)localObject10);
        localzc1.b(localzc1.c(), d1);
        localzc1.a(d2, 0.0D);
        d2 += localzc1.c() + this.h;
        ((w)localObject9).f();
        if (bool1) {
          a().doLayout(paramo);
        }
      }
    }
  }
  
  private static class c_
    implements Comparable
  {
    private final o a;
    private final a.c.e b;
    private int c;
    
    public c_(o paramo, a.c.e parame, int paramInt)
    {
      this.a = paramo;
      this.b = parame;
      this.c = paramInt;
    }
    
    public int compareTo(Object paramObject)
    {
      boolean bool = d.R;
      c_ localc_ = (c_)paramObject;
      if (!bool)
      {
        if (this.b == null) {
          return (paramObject == this) || (localc_.b == null) ? 0 : -1;
        }
        if (bool) {}
      }
      else if (localc_.b == null)
      {
        return 1;
      }
      zc localzc1 = this.a.k(this.b);
      zc localzc2 = this.a.k(localc_.b);
      double d1 = localzc1.a() + localzc1.c() * 0.5D;
      double d2 = localzc2.a() + localzc2.c() * 0.5D;
      int i = l.a(d1, d2);
      if (!bool) {
        if (i == 0) {
          return l.a(this.c, localc_.c);
        }
      }
      return i;
    }
  }
  
  private static class a_
    extends vc
  {
    double b;
    double m;
    
    private a_(Comparable paramComparable)
    {
      super();
    }
    
    a_(Comparable paramComparable, c.1 param1)
    {
      this(paramComparable);
    }
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.f.d.a.c

 * JD-Core Version:    0.7.0.1

 */